<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            *{
                list-style: none;
                margin: 0px;
                padding: 0px;
            }
            ul{
                /* 清除浮动塌陷 */
                overflow: hidden;
                margin-left: 700px;
            }
            li{
                float: left;
                width: 120px;
                height: 50px;
                text-align: center;
                /* 垂直居中 */
                line-height: 50px;
                /* 鼠标移入变小手指 */
                cursor: pointer;
            }
            div{
                width: 1800px;
                height: 600px;
                text-align: center;
                line-height: 300px;
                border: 1px solid red;
                /* 隐藏标签 */
                display: none;
                margin: auto;
            }
            div img{
                height: 600px;
            }
            li.current{
                background: red;
                color: white;
            }
            div.current{
                /* 显示标签 */
                display: block;
            }
        </style>
    </head>
    <body>
        <ul>
            <li class="current">马奎斯</li>
            <li>詹姆斯</li>
            <li>维纳斯</li>
            <li>托马斯</li>
        </ul>
        <section>
            <div class="current"><img src="imges/1.jpg" alt=""></div>
            <div><img src="imges/2.jpg" alt=""></div>
            <div><img src="imges/3.jpg" alt=""></div>
            <div><img src="imges/4.jpg" alt=""></div>
        </section>

        <script>
            // 通过标签名获取标签
            var tags=document.getElementsByTagName('li');
            var boxs=document.getElementsByTagName('div');
            // 遍历所有的标签
            for(var i=0;i<tags.length;i++)
            {
                // 自定义标签属性 给每一个li增加一个属性index
                tags[i].index=i;
                // 绑定点击事件
                tags[i].onclick=function()
                {
                    // 排他
                    for(var j=0;j<tags.length;j++)
                    {
                        tags[j].className=''
                        boxs[j].className=''
                    }

                    // 当前用户点击的增加量
                    this.className='current';
                    // 获取属性
                    var n=this.index;
                    boxs[n].className='current'
                }
            }
        </script>
    </body>
</html>